<%@ page language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<link rel="stylesheet" type="text/css" href="<%=path%>/css/button.css"/>
<link rel="stylesheet" type="text/css" href="<%=path%>/css/inputs.css"/>
<link rel="stylesheet" type="text/css" href="<%=path%>/css/app.css"/>
<script type="text/javascript" src="<%=path%>/js/check.js"></script>

    <div id="menubar">
        <img src="<%=path%>/images/left.png" style="margin-top:auto;margin-bottom:auto;width:15px; height:15px">图书入库
    </div>

    <s:if test="#session.loginState == 1 && #session.isAdmin == true">
        <form name="addbook" action="<%=path%>/admin/AdminAction_addBook.action?op=lib" method="post">
            <table id="inputs" width="40%"
                   style="margin: 0 auto; position: absolute;top: 150px; left: 0; bottom: 0; right: 0;overflow:auto;">

                <tr>
                    <th style="text-align:center;color:#0088cc">书&nbsp;名：</th>
                    <td>
                        <input name="bookname" type="text" placeholder="Book name" maxlength="16" autofocus required>
                    </td>
                </tr>

                <tr>
                    <th style="text-align:center;color:#0088cc">作&nbsp;者：</th>
                    <td>
                        <input name="author" type="text" placeholder="Author" maxlength="12" required>
                    </td>
                </tr>

                <tr>
                    <th style="text-align:center;color:#0088cc">出版社：</th>
                    <td>
                        <select name="publishing">
                            <s:iterator value="#session.publishing_list" var="publishing">
                                <option value="<s:property value="#publishing"/>"><s:property
                                        value="#publishing"/></option>
                            </s:iterator>
                        </select>
                    </td>
                </tr>

                <tr>
                    <th style="text-align:center;color:#0088cc">类&nbsp;别：</th>
                    <td>
                        <select name="category">

                            <s:iterator value="#session.category_list" var="category">
                                <option value="<s:property value="#category.category"/>"><s:property
                                        value="#category.category"/></option>
                            </s:iterator>
                        </select>
                    </td>
                </tr>

                <tr>
                    <th style="text-align:center;color:#0088cc">价&nbsp;格：</th>
                    <td>
                        <input name="price" type="number" min="1" placeholder="Price" required>
                    </td>
                    <td style="color: red;font-size: 16px">
                        <s:fielderror fieldName="priceError"/>
                    </td>
                </tr>

                <tr>
                    <th style="text-align:center;color:#0088cc">入库数量：</th>
                    <td>
                        <input type="number" name="quantityin" placeholder="QuantityIn" min="1" required>
                    </td>
                </tr>
            </table>

            <table width="10%"
                   style="margin: 0 auto; position: absolute;top: 570px; left: 0; bottom: 0; right: 0;overflow:auto;text-align: center">
                <tr>
                    <td>
                        <input type="submit" class="button" value="添加"/>
                    </td>
                </tr>
            </table>
        </form>
    </s:if>

    <s:else>
        <table width="100%" style="margin-top:50px;">
            <tr>
                <td>
                    <h2  style="text-align: center">请使用管理员账号登录！</h2>
                </td>
            </tr>
        </table>
    </s:else>
</html>
